]> dgit.raspbian.org Git - dovecot.git/commit
[PATCH 4/7] lib-sieve: Switch sieve_max_cpu_time enforcement to time-decayed re-enable
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 5 May 2026 16:30:23 +0000 (16:30 +0000)
committerNoah Meyerhans <noahm@debian.org>
Wed, 16 Sep 2026 19:06:35 +0000 (15:06 -0400)
commit443535260213435bc89e878a6c805a35bea3894b
treed5a6c8d446f5e9100f838c0771ff558f688dd931
parentfa01351c243cc67b0934420c02cf20b6a28f8be7
[PATCH 4/7] lib-sieve: Switch sieve_max_cpu_time enforcement to time-decayed re-enable

When a user's cumulative CPU time exceeded sieve_max_cpu_time, the
script was permanently disabled. SIEVE_BINARY_FLAG_RESOURCE_LIMIT was
set in the binary header on first overrun and was never cleared by
the resource_usage_timeout decay (which only zeroed the cpu_time
field), so sieve_binary_check_executable() refused execution forever
unless the binary was recompiled or an admin manually wiped the file.

Replace the sticky-flag model with one driven purely by the persisted
cumulative cpu_time, decayed by resource_usage_timeout:

 - Drop SIEVE_BINARY_FLAG_RESOURCE_LIMIT and the enum that defined it;
   nothing reads sbin->header.flags anymore.
 - sieve_binary_check_executable() and sieve_binary_check_resource_usage()
   call sieve_resource_usage_is_excessive() on the current cumulative
   cpu_time. Raising sieve_max_cpu_time now correctly re-enables a
   previously over-limit user without further intervention.
 - Gate per-user file persistence on the per-run delta, not the
   cumulative total. A refused-without-running attempt has a zero
   delta, skips the file write, and leaves update_time at the moment
   work was actually consumed. After resource_usage_timeout seconds
   of inactivity (or only-trivial deliveries) the next load decays
   the cpu_time to zero and the user is allowed to run again.

The on-disk per-user sieve-rusage file format becomes:

    V1 <cpu-secs> <update-time>

Gbp-Pq: Name 0004-lib-sieve-Switch-sieve_max_cpu_time-enforcement-to-t.patch
pigeonhole/src/lib-sieve/sieve-binary-file.c
pigeonhole/src/lib-sieve/sieve-binary-private.h
pigeonhole/src/lib-sieve/sieve-binary.c
pigeonhole/src/lib-sieve/sieve-rusage.c
pigeonhole/src/lib-sieve/sieve-rusage.h